import React, { Component } from 'react';

class Text extends Component {
  render() {
    const { getData, getStyle } = this.props;
    const style = getStyle();
    const { fontStyle, ...rest } = style;
    let fontStyleObj = null;
    switch (fontStyle) {
      case 'bold':
        fontStyleObj = { fontWeight: 'bold' };
        break;
      case 'italic':
        fontStyleObj = { fontStyle: 'italic' };
        break;
      case 'underline':
        fontStyleObj = { textDecoration: 'underline' };
        break;
      default:
        break;
    }
    return <div style={{ ...rest, ...fontStyleObj }}>{getData('text')}</div>;
  }
}

export default Text;
